function countFrequency(arr) {
  return arr.reduce(function (result, ele) {
    if (result.get(ele) != undefined) {
      result.set(ele, result.get(ele) + 1);
    } else {
      result.set(ele, 1);
    }
    return result;
  }, new Map());
}

let arr = [1, 1, 1, 1, 1, 3, 4, 657, 43, 3, 6];
console.log(countFrequency(arr));
for (let entry of countFrequency(arr).entries()) {
  console.log(entry[0] + ":" + entry[1]);
}
